import java.util.Random;
import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Lenovo
 * Date: 2025-05-25
 * Time: 14:26
 */
public class Test {
    public static void main(String[] args) {
        Random rand=new Random();
        int[] arr=new int[10];
        for (int i = 0; i < arr.length; i++) {
            arr[i]= rand.nextInt(100);
            System.out.print(arr[i]+"  ");
        }
        System.out.println("");
        System.out.println("请输入要查找的数");
        Scanner scan=new Scanner(System.in);
        int n=scan.nextInt();
        int p=0;
        for (int i = 0; i < arr.length; i++) {
            if(arr[i]==n){
                p=1;
                System.out.println("要查找的数下标为"+i);
            }
        }
        if(p==0)
            System.out.println("查找的数不存在");
    }
}

